package com.atbeijing.bigdata.spark.core.rdd.operator.transform

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

object Spark11_Oper_Transform {

    def main(args: Array[String]): Unit = {

        val conf = new SparkConf().setMaster("local[*]").setAppName("TransformOperator")
        val sc = new SparkContext(conf)

        // TODO 算子 - 转换 - coalesce

        val rdd = sc.makeRDD(List(1,2,3,4,5,6), 3)

        // coalesce - 缩减分区
        val rdd1: RDD[Int] = rdd.coalesce(2)

        // repartition - 扩大分区 - shuffle的coalesce
        val rdd2 = rdd.repartition(4)

        sc.stop()

    }
}
